Skip to content

feat: Migrate RGB underglow keycodes to UG_* with QMK build compat shim#924

Merged
yoichiro merged 1 commit intomainfrom
feature/workbench-ug-keycode-migration
Apr 22, 2026
Merged

feat: Migrate RGB underglow keycodes to UG_* with QMK build compat shim#924
yoichiro merged 1 commit intomainfrom
feature/workbench-ug-keycode-migration

Conversation

@yoichiro
Copy link
Copy Markdown
Collaborator

@yoichiro yoichiro commented Apr 22, 2026

Summary

  • Canonicalize underglow keycodes (0x7820-0x782A) to UG_* in keyInfoList: label ("UG Toggle" etc.), name.long/short ("UG_TOGG" etc.), and keywords include both new UG_* and legacy RGB_* lowercase aliases for search
  • Workbench keymap.c generator emits UG_* names via codeToName, and injects a RGB/UG compatibility shim (`#if !defined(UG_TOGG) && defined(RGB_TOG)` ... `#define UG_* RGB_*` ... `#endif`) so builds succeed on both modern and older QMK
  • Shim stripping anchors on the `#if` signature rather than marker comments, so legacy unmarked shims, duplicated shims, and blank-line accumulation are all normalized to a single canonical block on regenerate
  • QmkKeycodeMapper: UG_ALIASES inverted and renamed to LEGACY_UG_ALIASES (legacy → canonical direction), and the CODE_TO_UG_NAME override plus the UG_ branch in codeToName are removed since keyInfoList.name.long now returns UG_* naturally

Test plan

  • Build keymap.c with UG_* keycodes on modern QMK that lacks legacy RGB_* macros
  • Build keymap.c with UG_* keycodes on older QMK where RGB_* is defined (shim becomes a no-op)
  • Import a keymap.c whose body uses legacy RGB_TOG, edit another key in the visual editor, and confirm a single canonical shim appears and the body keycodes emit UG_*
  • Import a keymap.c that already contains a hand-written unmarked `#if !defined(UG_TOGG) && defined(RGB_TOG)` shim and confirm it is replaced by the canonical shim (no duplication)
  • Visual editor keytop shows "UG Toggle" / "UG Mode +" etc. when the source uses UG_*
  • Autocomplete popup finds the keycode when the user types "ug", "UG_TOGG", "rgb", or "rgb_tog"
  • Configure domain still lets users pick these keycodes and shows the new labels

Rename 0x7820-0x782A keyInfoList entries to modern QMK UG_* canonical names
(name.long/short, label, keywords). Workbench now emits UG_* in keymap.c and
injects a preprocessor shim that defines UG_* from RGB_* on older QMK.
Shim detection anchors on the #if !defined(UG_TOGG) && defined(RGB_TOG)
signature so legacy/unmarked variants are also stripped and canonicalized.
@yoichiro yoichiro merged commit 5818896 into main Apr 22, 2026
1 check passed
@yoichiro yoichiro deleted the feature/workbench-ug-keycode-migration branch April 22, 2026 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant